package com.wl.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wl.PageDTO;
import com.wl.entity.Brand;
import com.wl.enums.BrandStatusEnum;
import com.wl.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController {

    @Autowired
    private BrandService brandService;

    @GetMapping("page")
    public Page<Brand> page(PageDTO pageDTO, BrandStatusEnum status){
        return brandService.page(Page.of(pageDTO.getPageNum(),pageDTO.getPageSize()),status);
    }

    @GetMapping("copy")
    public String copy(){
        brandService.copy();
        return "ok";
    }

    @GetMapping("save")
    public String saveBrand(){
        brandService.saveBrand();
        return "ok";
    }
}
